<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<%@include file="/common/javascript.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>学生提问</title>
    
    <link href="${ctx}/static/css/index.css" rel="stylesheet" type="text/css" /> 
    <link href="${ctx}/static/ligerui/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" /> 
    <link href="${ctx}/static/ligerui/lib/css/common.css" rel="stylesheet" type="text/css" />  
    <link href="${ctx}/static/ligerui/lib/css/index.css" rel="stylesheet" type="text/css" />
    <link href="${ctx}/static/css/monitor/css/main.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    td {border-color:#ccc}
  	table {color:#08478A; font-size:14px; border-color:#ccc;}
	</style>    
    <script type="text/javascript">
    var mainform;
    var viewType = "${viewType}";

    $(function (){
    	$("#mainbody").ligerLayout({ height: '100%', heightDiff: -3, leftWidth: 140,minLeftWidth: 120 });
    	var bodyHeight = $(".l-layout-center:first").height();
    	
        mainform=$("#mainform");
        
        mainform.ligerForm();
        
        //如果是修改视图,主键不可编辑
        if(viewType=="modify"){
        	 $("#hpqId").attr("readonly", "readonly").removeAttr("validate");
        }
        
        //如果是详细试图,所有字段不可编辑
        if(viewType=="detail"){
        	$("input,select,textarea",mainform).attr("readonly", "readonly");
        }else{
            $.metadata.setType("attr", "validate");
            LG.validate(mainform);
        }
        
        $("#framecenter").css("height","285px");
        $(".l-layout-center").css("z-index","0");
        
        //渲染按钮
        LG.setFormDefaultBtn(cancel,viewType=="detail" ? null : save);

    });
   
    function save(){
        LG.submitForm(mainform, function (result) {
        	if(typeof(result)=="string"){
        		if(result.toLowerCase().indexOf("<pre>")>-1){
        			result = jQuery.parseJSON(jQuery(result).text());
        		}else{
        			result=eval("("+result+")");
        		}
        	}
            if (!result.success) {
                LG.showError('错误:' + result.message);
            }else {
                LG.showSuccess('保存成功', function () { 
                	saveSuccess();
                });
            }
        });
        
    }
    
    function saveSuccess(){
        var win = window.parent || window;
        if(win.askQuestionSuccess){
        	win.askQuestionSuccess();
        }
    }
    function cancel(){
        var win = window.parent || window;
        if(win.dialog){
        	win.dialog.close();
        }
    }
 </script>
</head>
<body style="text-align:center; background:url('${ctx}/static/ligerui/lib/images/qso/bg-1477x768.jpg'); overflow:hidden;">
    <div id="topmenu" class="l-topmenu" style="height:40px;">
        <div class="l-topmenu-logo" style="padding-left: 15px; padding-top:10px"><img src="${ctx}/static/css/student/img/help-logo-03.png" /></div>      
    </div> 
     <div id="mainbody" class="l-mainbody" style="width:99.2%; margin:0 auto; margin-top:3px;" >
        <div position="center" id="framecenter" style="background:#FFFFFF;height:290px;">
           <form name="mainform" method="post"  id="mainform" action="${ctx }/qso/helpque/save" ><!-- enctype="multipart/form-data" -->
		        <input type="hidden" name="viewType" value="${viewType}"/>
		        <input type="hidden" name="hpqId" value="${command.hpqId}"/>
		        <table class="l-table-edit" border="1" style="width: 96%; margin-top:10px; margin-left:5px;">                 
					<tr style="height:133px;">
		                <td align="right" class="l-table-edit-td" style="width:15%;border-right:none;">问题内容:</td>
		                <td align="left" class="l-table-edit-td" style="border-left:none;"> 
		                	<textarea cols="60" rows="3" class="l-textarea" id="hpqQuestion" name="hpqQuestion" ltype="text" validate="{required:true}" style="width:97%;height:120px;">${command.hpqQuestion}</textarea>
						</td>
					</tr>
<!-- 					<tr style="background-color:#D8E3F0;"> -->
<!-- 		                <td align="right" class="l-table-edit-td" style="width:15%;border-right:none;">附件上传:</td> -->
<!-- 		                <td align="left" class="l-table-edit-td" style="border-left:none;">  -->
<!-- 		                	<input type="file" name="file"/> -->
<!-- 						</td> -->
<!-- 					</tr> -->
		        </table>
		    </form>
		</div>
    </div>    
</body>
<!--
<body>
    <form name="mainform" method="post"  id="mainform" action="${ctx }/qso/helpque/save" enctype=”multipart/form-data”>
        <input type="hidden" name="viewType" value="${viewType}"/>
        <input type="hidden" name="hpqId" value="${command.hpqId}"/>
        <table cellpadding="0" cellspacing="0" class="l-table-edit" style="width: 90%; margin-top:10px; margin-left:15px;">                 
			<tr>
                <td align="right" class="l-table-edit-td" style="width:15%">问题:</td>
                <td align="left" class="l-table-edit-td" colspan="3"> 
                	<textarea cols="60" rows="3" class="l-textarea" id="hpqQuestion" name="hpqQuestion" ltype="text" validate="{required:true}" style="width:88%;">${command.hpqQuestion}</textarea>
				</td>
			</tr>
			<tr>
                <td align="right" class="l-table-edit-td" style="width:15%">附件:</td>
                <td align="left" class="l-table-edit-td" colspan="3"> 
                	<input type="file" name="file"/>
				</td>
			</tr>
        </table>
    </form>
</body>
-->
</html>

